package com.ruoyi.special.service.impl;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.db.domain.SpecialCostomManagerInfo;
import com.ruoyi.db.mapper.SpecialCostomManagerInfoMapper;
import com.ruoyi.special.service.ISpecialCostomManagerInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 机构客户经理信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-04-19
 */
@Service
@DataSource(DataSourceType.SLAVE)
public class SpecialCostomManagerInfoServiceImpl implements ISpecialCostomManagerInfoService 
{
    @Resource
    private SpecialCostomManagerInfoMapper specialCostomManagerInfoMapper;

    /**
     * 查询机构客户经理信息
     * 
     * @param userId 机构客户经理信息主键
     * @return 机构客户经理信息
     */
    @Override
    public SpecialCostomManagerInfo selectSpecialCostomManagerInfoByUserId(Long userId)
    {
        return specialCostomManagerInfoMapper.selectSpecialCostomManagerInfoByUserId(userId);
    }

    /**
     * 查询机构客户经理信息列表
     * 
     * @param specialCostomManagerInfo 机构客户经理信息
     * @return 机构客户经理信息
     */
    @Override
    public List<SpecialCostomManagerInfo> selectSpecialCostomManagerInfoList(SpecialCostomManagerInfo specialCostomManagerInfo)
    {
        return specialCostomManagerInfoMapper.selectSpecialCostomManagerInfoList(specialCostomManagerInfo);
    }

    /**
     * 查询机构客户经理信息列表
     *
     * @param specialCostomManagerInfo 机构客户经理信息
     * @return 机构客户经理信息
     */
    @Override
    public List<Map<String, Object>> selectSpecialCostomManagerInfoListMap(SpecialCostomManagerInfo specialCostomManagerInfo)
    {
        return specialCostomManagerInfoMapper.selectSpecialCostomManagerInfoListMap(specialCostomManagerInfo);
    }

    /**
     * 新增机构客户经理信息
     * 
     * @param specialCostomManagerInfo 机构客户经理信息
     * @return 结果
     */
    @Override
    public int insertSpecialCostomManagerInfo(SpecialCostomManagerInfo specialCostomManagerInfo)
    {
        specialCostomManagerInfo.setCreateTime(DateUtils.getNowDate());
        return specialCostomManagerInfoMapper.insertSpecialCostomManagerInfo(specialCostomManagerInfo);
    }

    /**
     * 修改机构客户经理信息
     * 
     * @param specialCostomManagerInfo 机构客户经理信息
     * @return 结果
     */
    @Override
    public int updateSpecialCostomManagerInfo(SpecialCostomManagerInfo specialCostomManagerInfo)
    {
        specialCostomManagerInfo.setUpdateTime(DateUtils.getNowDate());
        return specialCostomManagerInfoMapper.updateSpecialCostomManagerInfo(specialCostomManagerInfo);
    }

    /**
     * 批量删除机构客户经理信息
     * 
     * @param userIds 需要删除的机构客户经理信息主键
     * @return 结果
     */
    @Override
    public int deleteSpecialCostomManagerInfoByUserIds(String userIds)
    {
        return specialCostomManagerInfoMapper.deleteSpecialCostomManagerInfoByUserIds(Convert.toStrArray(userIds));
    }

    /**
     * 删除机构客户经理信息信息
     * 
     * @param userId 机构客户经理信息主键
     * @return 结果
     */
    @Override
    public int deleteSpecialCostomManagerInfoByUserId(Long userId)
    {
        return specialCostomManagerInfoMapper.deleteSpecialCostomManagerInfoByUserId(userId);
    }

    @Override
    public List<Map<String, Object>> getManagerInfoList(String type) {
        return specialCostomManagerInfoMapper.getManagerInfoList(type);
    }
}
